package xyz.codingli.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

/**
 * @author mizzle rain
 * @date 2021-01-10 20:59
 */
public class SetCookieServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        Cookie cookie = new Cookie("name", "Jack");
        cookie.setMaxAge(60 * 60);
        cookie.setPath("/");
        resp.addCookie(cookie);
        resp.getWriter().print("set cookie successful");
    }
}
